﻿@using DirigoEdge.Utils
@model List<Blog>

@* Blog Author *@
@{

    foreach (var blog in Model)
    {
        var user = "Anonymous";
        if (blog.Author != "")
        {
            user = blog.Author;
        }
        var blogAuthorUrl = "#";
        if (blog.Author != "")
        {
            blogAuthorUrl = blog.BlogAuthorUrl ?? "#";
        }
        
        var blogUrl = "/blog/" + blog.PermaLink + "/";

        <li class="blogItem relative" data-id="@blog.BlogId">
            
            <a href="@blogUrl">@blog.Title</a>
            
            @{
                string inCategoryLanguage = String.IsNullOrEmpty(blog.MainCategory) ? "" : " in <a class='categoryLink' href='/blog/categories/" + ContentUtils.GetFormattedUrl(blog.MainCategory) + "'/>" + blog.MainCategory + "</a>";
            }
            <p class="byLine">Written by <a href="@blogAuthorUrl">@user</a>@Html.Raw(inCategoryLanguage)</p>
                
            <p class="dateLine">@blog.Date.ToLongDateString()</p>
           
        </li>
    }
}